<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Administrator extends MY_Administrator {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/home
	 *	- or -  
	 * 		http://example.com/index.php/home/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
    function __construct()
    {
        parent::__construct();		
    }

	/**************************Welcome Page**************************/	 
	public function index()
	{
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates", $this->data);
	}
	/**************************End Welcome Page**************************/
	
	/**************************Search Page**************************/
	public function search_artist($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_artist();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);
	}
	
	public function search_song($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_song();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);		
	}
	
	public function search_album($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_album();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);		
	}
	
	public function search_news($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_news();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);		
	}

	public function search_chords($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_chords();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);		
	}
		
	public function search_video($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_video();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);
	}
	
	public function search_movie($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_movie();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);
	}
	
	public function search_gallery($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_gallery();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);
	}
	
	public function search_fashion($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_fashion();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);
	}
	
	public function search_calendar($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_calendar();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);
	}	
	
	public function search_playlist($refresh=NULL)
	{	
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_model->ajax_search_playlist();
		endif;
		
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js');
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);
	}				
	/**************************End Search Page**************************/
	
	/**************************Player Page**************************/
	public function music_player($id=NULL)
	{
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js','media/jwplayer.js');
					
		$this->data['dataResult'] = $this->db->select('t.song_id,j.song_file_name,j.song_file_ext,t.create_date')
		->join('song_info as j','j.song_id=t.song_id','INNER')
		->get_where('song as t',array('t.song_id' => $id),1)
		->row();
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);	
	}	
	
	public function video_player($id=NULL)
	{
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js','media/jwplayer.js');
					
		$this->data['dataResult'] = $this->db->select('t.video_id,j.video_file_name,j.video_file_ext,t.create_date')
		->join('video_info as j','j.video_id=t.video_id','INNER')
		->get_where('video as t',array('t.video_id' => $id),1)
		->row();
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);	
	}	
	
	public function movie_player($id=NULL,$num=NULL)
	{
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js','media/jwplayer.js');
					
		$this->data['dataResult'] = $this->db->select('t.movie_id,j.movie_file_name'.$num.' as movie_file_name,j.movie_file_ext'.$num.' as movie_file_ext,t.create_date')
		->join('movie_info as j','j.movie_id=t.movie_id','INNER')
		->get_where('movie as t',array('t.movie_id' => $id),1)
		->row();
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);	
	}
	
	public function chords_player($id=NULL)
	{
		/*Initail Clear Js*/
		$this->data['js'] = array('jquery-1.8.3.min.js','media/jwplayer.js');
					
		$this->data['dataResult'] = $this->db->select('t.article_id,j.clip_file_name,j.clip_file_ext,t.create_date')
		->join('chords_article_info as j','j.article_id=t.article_id','INNER')
		->get_where('chords_article as t',array('t.article_id' => $id),1)
		->row();
		
		$this->data['content'] = $this->router->class."/".$this->router->method;
		$this->load->view("templates/".$this->folder_templates."templates_popup", $this->data);	
	}		
	/**************************End Player Page**************************/
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */